#ifndef ARRAY_ALGORITHM_H
#define ARRAY_ALGORITHM_H
#include <iostream>
using namespace std;
template<typename T>
void bubbleSort(T arr[], int length) {
    if (arr == nullptr || length < 2) {
        return;
    }
    for (int e = length - 1; e > 0; e--) {
        for (int i = 0; i < e; i++) {
            if (arr[i] > arr[i + 1]) {
                T temp = arr[i];
                arr[i] = arr[i + 1];
                arr[i + 1] = temp;
            }
        }
    }
}


template<typename T, typename BinaryFunc>
void mySort(T *a, int n, BinaryFunc bf) {
    (*bf)(a, n);
}

template<typename T>
T myMax(T arr[], int length) {
    T max = arr[0];
    for (int i = 1; i < length; i++) {
        if (arr[i] > max) {
            max = arr[i];
        }
    }
    return max;
}


#endif